<!-- currentPageId-editor.vue -->
<template>
  <div>
    <el-form-item v-if="optionModel.currentPageType === 'fixed'" prop="currentPageId" label="当前页面">
      <el-select v-model="optionModel.currentPageId">
        <el-option 
          v-for="i in pageCount" 
          :key="i-1" 
          :label="`第${i}页 (ID: ${i-1})`" 
          :value="i-1">
        </el-option>
      </el-select>
    </el-form-item>
    
    <template v-else>
      <el-form-item prop="currentPageUserDataId" label="数据区ID">
        <el-input-number 
          v-model="optionModel.currentPageUserDataId"
          :min="0"
          :max="79"
          :step="1"
        ></el-input-number>
      </el-form-item>
      <el-form-item prop="currentPageUserDataAddress" label="数据区地址">
        <el-input-number 
          v-model="optionModel.currentPageUserDataAddress"
          :min="0"
          :max="511"
          :step="1"
        ></el-input-number>
      </el-form-item>
    </template>
  </div>
</template>

<script>
export default {
  name: 'CurrentPageIdEditor',
  props: {
    designer: Object,
    selectedWidget: Object,
    optionModel: Object
  },
  computed: {
    pageCount() {
      return this.selectedWidget.widgetList?.length || 1
    }
  }
}
</script>